////
////  HomeVC.swift
////  XiaohuijiVPN
////
////  Created by topnet on 2022/9/28.
////
//
//import Foundation
//import UIKit
//import PureLayout
//import Lottie
//import Macaw
//import NetworkExtension
//import GoogleMobileAds
//
//class HomeVC: ICBaseVC {
//
//
//    override func viewDidLoad() {
//        super.viewDidLoad()
//
//
//    }
//
//    override func _initUI() {
//        super._initUI()
//        navBar.titleV.text = "小灰机"
//
//        animationView = UIView()
//
//        view.da.addSubviews(sub: [upV, downV, animationView])
//    }
//
//    override func _initData() {
//        upV.iv.image = UIImage(named: "img_chart_upload")
//        downV.iv.image = UIImage(named: "img_chart_download")
//    }
//
//    override func _initFrame() {
//        super._initFrame()
//        upV.top(20.adapter).width(150.adapter).left((view.bounds.width/2-150.adapter)/2)
//        upV.initFrame()
//        downV.top_bottom_width_offsetLeft(upV, x: upV.frame.minX * 2)
//    }
//
//    fileprivate lazy var upV = TrendView()
//    fileprivate lazy var downV = TrendView()
//    fileprivate let animationViewLayer = AnimationView()
//    fileprivate var animationView: UIView!
//    fileprivate var timer: Timer?
//    fileprivate var loginModel: LoginModel = .init()
//
//    fileprivate var interstitial:GADInterstitial?
//    fileprivate var bannerView: GADBannerView!
//}
//
//
//fileprivate extension HomeVC {
//    func play(animation: String) {
//        let animation = Animation.named(animation, subdirectory: "lottie")
//        self.animationViewLayer.animation = animation
//        self.animationViewLayer.layer.masksToBounds = true
//        self.animationViewLayer.contentMode = .scaleAspectFit
//        self.animationView.addSubview(self.animationViewLayer)
//        self.animationViewLayer.autoPinEdgesToSuperviewEdges()
//        self.animationView.backgroundColor = .clear
//        self.animationViewLayer.play()
//        self.animationViewLayer.loopMode = .loop
//        self.animationViewLayer.backgroundBehavior = .pauseAndRestore
//    }
//
//    /** OBSEVER */
//    func vpnStateChanged(status: NEVPNStatus) {
//        self.setupButton()
//        switch status {
//        case .connected:
//            UserDefaults.standard.synchronize()
//            if StoreKit.shared.isActivePaidSubscription() == true {
//                self.play(animation: "XiaohuijiVPN_Premium_Connected")
//            }else {
//                self.play(animation: "XiaohuijiVPN_Free_Connected")
//                // open ads intersested
//                if self.interstitial?.isReady == true && StoreKit.shared.isActivePaidSubscription() == false {
//                    self.interstitial?.present(fromRootViewController: self)
//                }
//            }
//            self.animatingButton.backgroundColor = UIColor.selectedBackground
//            self.animatingButton.frame = .init(x: 0, y: 0, width: self.btnConnect.frame.width, height: self.btnConnect.frame.height)
//            self.btnConnect.update(text: "断开")
//            self.timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { (timer) in
//                self.getDataUsage()
//            }
//        case .disconnected:
//            self.animatingButton.backgroundColor = UIColor.clear
//            self.animatingButton.frame = .init(x: 0, y: 0, width: 0, height: self.btnConnect.frame.height)
//            self.btnConnect.update(text: "连接")
//        default :
//            if StoreKit.shared.isActivePaidSubscription() == true {
//                self.play(animation: "XiaohuijiVPN_Premium_Disconnected")
//            }else {
//                self.play(animation: "XiaohuijiVPN_Free_Disconnected")
//            }
//            debugPrint("status : \(status)")
//        }
//    }
//}
